package com.tj.jinzao.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.tj.jinzao.R;
import com.tj.jinzao.base.BaseListAdapter;
import com.tj.jinzao.model.Case;

import java.util.concurrent.CopyOnWriteArrayList;


/**
 * 报告 Adapter
 * Created by wjy on 2019/1/10.
 */
public class CaseListItemAdapter extends BaseListAdapter<Case, CaseListItemAdapter.ViewHolder> {

    public CaseListItemAdapter(Context context, CopyOnWriteArrayList data) {
        super(context, data);
    }

    @Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext())
                .inflate(R.layout.item_case_list, parent, false);
        return new ViewHolder(view);
    }

    @Override
    public void onBindViewHolder(ViewHolder holder, int position) {
        Case bean = mData.get(position);
        holder.name.setText(bean.getName());
        holder.date.setText(bean.getReportTime());
    }

    public class ViewHolder extends RecyclerView.ViewHolder {
        TextView name, date;

        public ViewHolder(View itemView) {
            super(itemView);
            name = itemView.findViewById(R.id.tv_name);
            date = itemView.findViewById(R.id.tv_date);
        }
    }


}
